package com.my.chapter18;

import java.io.*;
import java.util.*;

public class practice7 {
    public static List<String>
    read(String fileName) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader(fileName));
        List<String> lk = new LinkedList<String>();
        String s;
        while((s = in.readLine())!=null){
            lk.add(s);
        }
        in.close();
        return lk;
    }

    public static void main(String[] args) throws IOException {
        List<String> list = read(".\\src\\com\\my\\chapter18\\practice7.java");
        for(ListIterator<String> it =
            list.listIterator(list.size()); it.hasPrevious();)
            System.out.println(it.previous());
    }
}
